home *** CD-ROM | disk | FTP | other *** search
/ CD Mania / CD Mania.iso / wfsound.mst < prev   
Text File  |  1994-05-01  |  21KB  |  855 lines

  1. '**************************************************************************
  2. '*                Wired for Sound Pro CD Install Script
  3. '*     version 1.2 CD   by Aaron Wallace  (c) 1993 Aristosoft, Inc
  4. '**************************************************************************
  5.  
  6. '' Define DEBUG for script debugging
  7.  
  8. '$INCLUDE 'setupapi.inc'
  9. '$INCLUDE 'msdetect.inc'
  10.  
  11. ''Dialog ID's
  12. CONST WELCOME      = 100
  13. CONST ASKQUIT      = 200
  14. CONST DESTPATH     = 300
  15. CONST EXITFAILURE  = 400
  16. CONST EXITQUIT     = 600
  17. CONST EXITSUCCESS  = 700
  18. CONST WHICHINST    = 800
  19. CONST APPHELP      = 900
  20. CONST WHICHINSTHLP = 910
  21. CONST SETOWNER       = 1000
  22. CONST TESTSOUND    = 1100
  23. CONST INSTALLDRV   = 1200
  24. CONST SOUNDPLAYED  = 1300
  25. CONST WAITDLG       = 1400
  26. CONST EXITREBOOT   = 1500
  27. CONST WHICHVOICE   = 1600
  28. CONST BBD1       = 5000
  29. CONST BBD2       = 5010
  30. CONST BBD3       = 5020
  31. CONST BBD4       = 5030
  32. CONST BBD5       = 5040
  33. CONST BBD6       = 5050
  34. CONST SOUNDSDLG    = 5200
  35. CONST TAPPSDLG     = 5300
  36. CONST VOICESDLG    = 5400
  37. CONST CUSTINST     = 6200
  38. CONST TOOBIG       = 6300
  39. CONST BADPATH      = 6400
  40.  
  41. '' For message boxes
  42. CONST MB_YESNO=4
  43. CONST MB_RETRYCANCEL=5
  44. CONST IDNO=7
  45. CONST IDYES=6
  46. CONST IDRETRY=4
  47. CONST IDCANCEL=2
  48.  
  49. ''Bitmap ID
  50. CONST LOGO         = 1
  51.  
  52. ''File Types
  53. CONST BASEFILES     = 1
  54. CONST TAPPFILES     = 2
  55. CONST SOUNDFILES    = 3
  56. CONST VOICEFILES    = 4
  57. CONST MAX_TYPES     = 4
  58.  
  59. ''Install directories, etc.
  60. GLOBAL DEST$        ''Default destination directory.
  61. GLOBAL WINDRIVE$    ''Windows drive letter.
  62. GLOBAL CUIDLL$        ''CUI DLL
  63. GLOBAL WINDIR$        ''Windows directory
  64. GLOBAL SYSDIR$        ''System directory
  65. GLOBAL WININI$        ''"win.ini"
  66. GLOBAL SYSINI$        ''GetWindowsDir() + "system.ini"
  67.  
  68. '' User info
  69. GLOBAL OWNER$        '' Product registered owner
  70. GLOBAL WORKPLACE$   '' Company or such
  71.  
  72. ''Install item lists
  73. GLOBAL BASE$        ''List of base files
  74. GLOBAL TAPPS$       ''List of all talking apps
  75. GLOBAL SOUNDS$      ''List of all sounds.
  76. GLOBAL VOICES$      ''List of available voices
  77.  
  78. GLOBAL BASEINST$    ''List of base files to install
  79. GLOBAL TAPPSINST$   ''List of Talking Apps to install
  80. GLOBAL SOUNDSINST$  ''List of sounds to install
  81. GLOBAL VOICESINST$  ''List of voices to install
  82.  
  83. ''Custom Install list symbol names
  84. GLOBAL BASENEEDS$   ''Option list costs per drive
  85. GLOBAL TAPPNEEDS$
  86. GLOBAL SOUNDNEEDS$
  87. GLOBAL VOICENEEDS$
  88. GLOBAL EXTRACOSTS$  ''List of extra costs to add per drive
  89.  
  90. ''Custom Install dialog list symbol names
  91. GLOBAL CHECKSTATES$ ''List of check box values
  92. GLOBAL STATUSTEXT$  ''List of values to initialize status items
  93. GLOBAL DRIVETEXT$   ''Drive space info, etc.
  94.  
  95. '' Install DSOUND
  96. GLOBAL INSTDSOUND%
  97.  
  98. '' Customize product
  99. GLOBAL CUSTOMIZE%
  100.  
  101. '' Test sound hardware
  102. GLOBAL DOTEST%
  103.  
  104. GLOBAL WFSFOUND%
  105. GLOBAL CUSTINSTALL%
  106.  
  107. '' Which type of install to perform, by default
  108. GLOBAL DEFINSTOPT$
  109.  
  110. ''Progman titles
  111. GLOBAL WFSAPP$        ''Name of WFS app
  112.  
  113. ''Win.ini [Aristosoft] install code
  114. GLOBAL INSTDIR$
  115.  
  116. ''Space requirements
  117. GLOBAL FITS%        '' > 0 if everything fits
  118.  
  119. DECLARE SUB RecalcOptFiles (ftype%)
  120. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  121. DECLARE FUNCTION GetWindowsVersionCorrectly& ()
  122. DECLARE FUNCTION MakeVer& (x as integer, y as integer)
  123. DECLARE FUNCTION StringInList (s$, y$) AS INTEGER
  124.  
  125. DECLARE FUNCTION sndPlaySound LIB "MMSYSTEM.DLL" (f$, fl%) AS INTEGER
  126. DECLARE FUNCTION GetModuleHandle LIB "KERNEL" (f$) AS INTEGER
  127.  
  128. DECLARE SUB Ctl3dRegister LIB "WFSUI.DLL" (f%)
  129. DECLARE SUB Ctl3dAutoSubclass LIB "WFSUI.DLL" (f%)
  130. DECLARE SUB Ctl3dUnregister LIB "WFSUI.DLL" (f%)
  131.  
  132. DECLARE SUB RemoveSectionFiles (dest$, sect$)
  133. DECLARE SUB RemDirectory (d$)
  134. DECLARE FUNCTION HasSoundDriver() AS INTEGER
  135. DECLARE SUB SendProgmanCommand LIB "CUI.DLL" (s$)
  136. DECLARE SUB KillFiles LIB "CUI.DLL" (s$)
  137.  
  138. '' These are defined in wfs.inc (product-specific)
  139. DECLARE SUB SetProductTitles
  140. DECLARE FUNCTION InfFile() AS STRING
  141. DECLARE FUNCTION MakeInstDir(D$) AS STRING
  142. DECLARE SUB AddInfSectionNames (BASE$, TAPPS$, SOUNDS$, VOICES$, BASEINST$, TAPPSINST$, SOUNDSINST$, VOICESINST$)
  143. DECLARE SUB RecalcPath
  144. DECLARE SUB AddOptFilesToCopyList (ftype%)
  145. DECLARE SUB SetDriveStatus
  146. DECLARE SUB AddOptFiles
  147. DECLARE SUB ConfigureApps
  148. DECLARE SUB AddBillboards
  149. DECLARE SUB DoUninstall
  150.  
  151.  
  152. '' This is where it all begins!
  153.  
  154. INIT:
  155.  
  156.     CUIDLL$ = "cui.dll"
  157.     DEFINSTOPT$ = "1"
  158.     INSTDSOUND% = 0
  159.     CUSTOMIZE% = -1
  160.     DOTEST% = -1
  161.  
  162.     SetProductTitles
  163.  
  164.     HELPPROC$ = "FHelpDlgProc"        ''Help dialog procedure
  165.  
  166.     SetBitmap CUIDLL$, LOGO
  167.  
  168.  
  169. '' We don't do Windows 3.0...
  170.  
  171.     If GetWindowsVersionCorrectly() < MakeVer(3, 10) Then
  172.     i% = DoMsgBox("This product requires Windows version 3.10 or greater", WFSAPP$, MB_OK)
  173.     GOTO DONEFINIFIN
  174.     End If
  175.  
  176. '' We don't want these DLLs to be loaded quite yet...
  177. LookAround:
  178.     IF GetModuleHandle("SNDAPI") OR GetModuleHandle("WFSABOUT") THEN
  179.     i% = DoMsgBox("Please quit all other Aristosoft products before continuing with Setup.", WFSAPP$, MB_RETRYCANCEL)
  180.     IF i% = IDRETRY THEN
  181.         GOTO LookAround
  182.     ELSEIF i% = IDCANCEL THEN
  183.         GOTO DONEFINIFIN
  184.     END IF
  185.     END IF
  186.  
  187.     HCUI% = GetModuleHandle("CUI")
  188.     Ctl3dRegister(HCUI%)
  189.     Ctl3dAutoSubclass(HCUI%)
  190.  
  191. ''Find location of INF file and create a default dest. dir
  192.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  193.     IF szInf$ = "" THEN
  194.     szInf$ = GetSymbolValue("STF_CWDDIR") + InfFile()
  195.     END IF
  196.  
  197.     '' Load the INF file
  198.     ReadInfFile szInf$
  199.  
  200.     '' Construct default strings
  201.     WINDIR$ = GetWindowsDir()
  202.     SYSDIR$ = GetWindowsSysDir()
  203.     WININI$ = "win.ini"
  204.     SYSINI$ = MakePath(WINDIR$, "system.ini")
  205.  
  206.     '' Construct the default install path
  207.     WINDRIVE$ = MID$(WINDIR$, 1, 1)
  208.     DEST$ = MakeInstDir(WINDRIVE$)
  209.  
  210.     '' Setup install symbols
  211.     BASE$ = "Base Files"
  212.     TAPPS$ = "Talking Apps"
  213.     SOUNDS$ = "Sounds"
  214.     VOICES$ = "Voices"
  215.     BASEINST$ = "Base Files Inst"
  216.     TAPPSINST$ = "Talking Apps Inst"
  217.     SOUNDSINST$ = "Sounds Inst"
  218.     VOICESINST$ = "Voices Inst"
  219.  
  220.     SetSymbolValue BASE$, ""
  221.     SetSymbolValue TAPPS$, ""
  222.     SetSymbolValue SOUNDS$, ""
  223.     SetSymbolValue VOICES$, ""
  224.  
  225.     ''Set up symbols for the initial install dialog
  226.     RADIODEFAULT$ = "Radio Default"
  227.  
  228.     ''Set up symbols for the custom install dialog
  229.     CHECKSTATES$ = "CheckItemsState"
  230.     STATUSTEXT$  = "StatusItemsText"
  231.     DRIVETEXT$   = "DriveStatusText"
  232.     FOR i% = 1 TO 4 STEP 1
  233.     AddListItem CHECKSTATES$, "ON"
  234.     NEXT i%
  235.     FOR i% = 1 TO 4 STEP 1
  236.     AddListItem STATUSTEXT$, ""
  237.     NEXT i%
  238.     FOR i% = 1 TO 7 STEP 1
  239.     AddListItem DRIVETEXT$, ""
  240.     NEXT i%
  241.     ReplaceListItem DRIVETEXT$, 7, DEST$
  242.  
  243.     ''Disk cost list symbols
  244.     BASENEEDS$   = "BaseNeeds"
  245.     TAPPNEEDS$   = "TAppNeeds"
  246.     SOUNDNEEDS$  = "SoundNeeds"
  247.     VOICENEEDS$  = "VoiceNeeds"
  248.     EXTRACOSTS$  = "ExtraCosts"
  249.     FOR i% = 1 TO 26 STEP 1
  250.     AddListItem EXTRACOSTS$, "0"
  251.     NEXT i%
  252.  
  253.     ''Configure lists of installable files
  254.     AddInfSectionNames BASE$, TAPPS$, SOUNDS$, VOICES$, BASEINST$, TAPPSINST$, SOUNDSINST$, VOICESINST$
  255.  
  256. '$IFDEF DEBUG
  257.     i% = SetSizeCheckMode(scmOnIgnore)    '' could use scmOff; def = scmOnFatal
  258. '$ENDIF ''DEBUG
  259.  
  260.  
  261. '' Ask which voice to use
  262. '' See if users want an easy install, custom install, or no install...
  263. WHICHVOICE:
  264.     SetSymbolValue "RadioDefault", "1"
  265.  
  266.     sz$ = UIStartDlg(CUIDLL$, WHICHVOICE, "FRadioDlgProc", WHICHINSTHLP, HELPPROC$)
  267.     
  268.     ''sz$ is the button the user pressed; RADIODEFAULT$ is the option selected
  269.  
  270.     IF sz$ = "EXIT" THEN
  271.     GOSUB ASKQUIT
  272.     GOTO WHICHVOICE
  273.     ELSEIF sz$ = "CONTINUE" THEN
  274.     sz$ = GetSymbolValue("ButtonChecked")
  275.     IF sz$ = "1" THEN
  276.         UIPop 1
  277.         INSTSNDDIR$ = MakePath(GetSymbolValue("STF_SRCDIR"), "sounds\install\simmons")
  278.         GOTO WELCOME
  279.     ELSEIF sz$ = "2" THEN
  280.         UIPop 1
  281.         INSTSNDDIR$ = MakePath(GetSymbolValue("STF_SRCDIR"), "sounds\install\sultry")
  282.         GOTO WELCOME
  283.     ELSEIF sz$ = "3" THEN
  284.         UIPop 1
  285.         INSTSNDDIR$ = MakePath(GetSymbolValue("STF_SRCDIR"), "sounds\install\harold")
  286.         GOTO WELCOME
  287.     END IF
  288.     END IF
  289.     GOTO WHICHVO